home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Shareware / Mockups for Desktop 1.5.27 / MockupsForDesktop.air / MockupsAir.swf / scripts / SaveMultipleDialog.as < prev    next >
Encoding:
Text File  |  2009-03-03  |  14.1 KB  |  431 lines

  1. package
  2. {
  3.    import com.plus9.mockups.InputManager;
  4.    import com.plus9.mockups.dialogs.BaseDialog;
  5.    import flash.accessibility.*;
  6.    import flash.data.*;
  7.    import flash.debugger.*;
  8.    import flash.desktop.*;
  9.    import flash.display.*;
  10.    import flash.errors.*;
  11.    import flash.events.*;
  12.    import flash.external.*;
  13.    import flash.filesystem.*;
  14.    import flash.filters.*;
  15.    import flash.geom.*;
  16.    import flash.html.*;
  17.    import flash.html.script.*;
  18.    import flash.media.*;
  19.    import flash.net.*;
  20.    import flash.printing.*;
  21.    import flash.profiler.*;
  22.    import flash.system.*;
  23.    import flash.text.*;
  24.    import flash.ui.*;
  25.    import flash.utils.*;
  26.    import flash.xml.*;
  27.    import mx.binding.*;
  28.    import mx.containers.ControlBar;
  29.    import mx.containers.HBox;
  30.    import mx.controls.Button;
  31.    import mx.controls.Label;
  32.    import mx.controls.List;
  33.    import mx.core.ClassFactory;
  34.    import mx.core.UIComponentDescriptor;
  35.    import mx.core.mx_internal;
  36.    import mx.events.PropertyChangeEvent;
  37.    import mx.styles.*;
  38.    
  39.    use namespace mx_internal;
  40.    
  41.    public class SaveMultipleDialog extends BaseDialog implements IBindingClient
  42.    {
  43.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  44.       
  45.       private var _91216686_quit:Button;
  46.       
  47.       mx_internal var _bindingsByDestination:Object;
  48.       
  49.       mx_internal var _bindingsBeginWithWord:Object;
  50.       
  51.       private var _339742651dataProvider:Array;
  52.       
  53.       mx_internal var _watchers:Array;
  54.       
  55.       private var _17584667_deselectAll:Button;
  56.       
  57.       private var _1340746649_cancel:Button;
  58.       
  59.       private var _1090049414_selectAll:Button;
  60.       
  61.       private var _91257436_save:Button;
  62.       
  63.       mx_internal var _bindings:Array;
  64.       
  65.       private var _documentDescriptor_:UIComponentDescriptor;
  66.       
  67.       private var _91056509_list:List;
  68.       
  69.       public function SaveMultipleDialog()
  70.       {
  71.          _documentDescriptor_ = new UIComponentDescriptor({
  72.             "type":BaseDialog,
  73.             "propertiesFactory":function():Object
  74.             {
  75.                return {
  76.                   "width":402,
  77.                   "height":364,
  78.                   "childDescriptors":[new UIComponentDescriptor({
  79.                      "type":Label,
  80.                      "propertiesFactory":function():Object
  81.                      {
  82.                         return {
  83.                            "x":10,
  84.                            "y":10,
  85.                            "text":"Please select the mockups to save"
  86.                         };
  87.                      }
  88.                   }),new UIComponentDescriptor({
  89.                      "type":List,
  90.                      "id":"_list",
  91.                      "stylesFactory":function():void
  92.                      {
  93.                         this.left = "10";
  94.                         this.right = "10";
  95.                         this.top = "35";
  96.                         this.bottom = "37";
  97.                         this.backgroundAlpha = 0;
  98.                         this.color = 0;
  99.                         this.textRollOverColor = 0;
  100.                         this.textSelectedColor = 0;
  101.                         this.rollOverColor = 13421772;
  102.                      },
  103.                      "propertiesFactory":function():Object
  104.                      {
  105.                         return {"selectable":false};
  106.                      }
  107.                   }),new UIComponentDescriptor({
  108.                      "type":Button,
  109.                      "id":"_selectAll",
  110.                      "events":{"click":"___selectAll_click"},
  111.                      "stylesFactory":function():void
  112.                      {
  113.                         this.bottom = "10";
  114.                      },
  115.                      "propertiesFactory":function():Object
  116.                      {
  117.                         return {
  118.                            "x":10,
  119.                            "label":"Select All"
  120.                         };
  121.                      }
  122.                   }),new UIComponentDescriptor({
  123.                      "type":Button,
  124.                      "id":"_deselectAll",
  125.                      "events":{"click":"___deselectAll_click"},
  126.                      "stylesFactory":function():void
  127.                      {
  128.                         this.bottom = "10";
  129.                      },
  130.                      "propertiesFactory":function():Object
  131.                      {
  132.                         return {
  133.                            "x":84,
  134.                            "label":"Deselect All"
  135.                         };
  136.                      }
  137.                   }),new UIComponentDescriptor({
  138.                      "type":ControlBar,
  139.                      "stylesFactory":function():void
  140.                      {
  141.                         this.horizontalAlign = "right";
  142.                      },
  143.                      "propertiesFactory":function():Object
  144.                      {
  145.                         return {"childDescriptors":[new UIComponentDescriptor({
  146.                            "type":HBox,
  147.                            "propertiesFactory":function():Object
  148.                            {
  149.                               return {"childDescriptors":[new UIComponentDescriptor({
  150.                                  "type":Button,
  151.                                  "id":"_cancel",
  152.                                  "events":{"click":"___cancel_click"},
  153.                                  "propertiesFactory":function():Object
  154.                                  {
  155.                                     return {"label":"Don\'t Quit"};
  156.                                  }
  157.                               }),new UIComponentDescriptor({
  158.                                  "type":Button,
  159.                                  "id":"_save",
  160.                                  "events":{"click":"___save_click"},
  161.                                  "propertiesFactory":function():Object
  162.                                  {
  163.                                     return {"label":"Save and Quit"};
  164.                                  }
  165.                               }),new UIComponentDescriptor({
  166.                                  "type":Button,
  167.                                  "id":"_quit",
  168.                                  "events":{"click":"___quit_click"},
  169.                                  "propertiesFactory":function():Object
  170.                                  {
  171.                                     return {"label":"Quit without Saving"};
  172.                                  }
  173.                               })]};
  174.                            }
  175.                         })]};
  176.                      }
  177.                   })]
  178.                };
  179.             }
  180.          });
  181.          mx_internal::_bindings = [];
  182.          mx_internal::_watchers = [];
  183.          mx_internal::_bindingsByDestination = {};
  184.          mx_internal::_bindingsBeginWithWord = {};
  185.          super();
  186.          mx_internal::_document = this;
  187.          this.width = 402;
  188.          this.height = 364;
  189.          this.title = "Save Mockups";
  190.       }
  191.       
  192.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  193.       {
  194.          SaveMultipleDialog._watcherSetupUtil = param1;
  195.       }
  196.       
  197.       public function ___cancel_click(param1:MouseEvent) : void
  198.       {
  199.          onCancel();
  200.       }
  201.       
  202.       public function ___save_click(param1:MouseEvent) : void
  203.       {
  204.          onClick(param1);
  205.       }
  206.       
  207.       [Bindable(event="propertyChange")]
  208.       public function get _selectAll() : Button
  209.       {
  210.          return this._1090049414_selectAll;
  211.       }
  212.       
  213.       public function set dataProvider(param1:Array) : void
  214.       {
  215.          var _loc2_:Object = this._339742651dataProvider;
  216.          if(_loc2_ !== param1)
  217.          {
  218.             this._339742651dataProvider = param1;
  219.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"dataProvider",_loc2_,param1));
  220.          }
  221.       }
  222.       
  223.       public function set _list(param1:List) : void
  224.       {
  225.          var _loc2_:Object = this._91056509_list;
  226.          if(_loc2_ !== param1)
  227.          {
  228.             this._91056509_list = param1;
  229.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_list",_loc2_,param1));
  230.          }
  231.       }
  232.       
  233.       public function ___deselectAll_click(param1:MouseEvent) : void
  234.       {
  235.          onClick(param1);
  236.       }
  237.       
  238.       [Bindable(event="propertyChange")]
  239.       public function get dataProvider() : Array
  240.       {
  241.          return this._339742651dataProvider;
  242.       }
  243.       
  244.       override public function init(param1:InputManager) : void
  245.       {
  246.          super.init(param1);
  247.          _list.itemRenderer = new ClassFactory(CheckBoxItemRenderer);
  248.          _list.rendererIsEditor = true;
  249.          defaultButton = _save;
  250.          _save.setFocus();
  251.       }
  252.       
  253.       public function set _deselectAll(param1:Button) : void
  254.       {
  255.          var _loc2_:Object = this._17584667_deselectAll;
  256.          if(_loc2_ !== param1)
  257.          {
  258.             this._17584667_deselectAll = param1;
  259.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_deselectAll",_loc2_,param1));
  260.          }
  261.       }
  262.       
  263.       public function set _selectAll(param1:Button) : void
  264.       {
  265.          var _loc2_:Object = this._1090049414_selectAll;
  266.          if(_loc2_ !== param1)
  267.          {
  268.             this._1090049414_selectAll = param1;
  269.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_selectAll",_loc2_,param1));
  270.          }
  271.       }
  272.       
  273.       public function set _quit(param1:Button) : void
  274.       {
  275.          var _loc2_:Object = this._91216686_quit;
  276.          if(_loc2_ !== param1)
  277.          {
  278.             this._91216686_quit = param1;
  279.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_quit",_loc2_,param1));
  280.          }
  281.       }
  282.       
  283.       public function ___quit_click(param1:MouseEvent) : void
  284.       {
  285.          onClick(param1);
  286.       }
  287.       
  288.       override public function initialize() : void
  289.       {
  290.          var bindings:Array;
  291.          var watchers:Array;
  292.          var i:uint;
  293.          var target:SaveMultipleDialog = null;
  294.          var watcherSetupUtilClass:Object = null;
  295.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  296.          bindings = _SaveMultipleDialog_bindingsSetup();
  297.          watchers = [];
  298.          target = this;
  299.          if(_watcherSetupUtil == null)
  300.          {
  301.             watcherSetupUtilClass = getDefinitionByName("_SaveMultipleDialogWatcherSetupUtil");
  302.             watcherSetupUtilClass["init"](null);
  303.          }
  304.          _watcherSetupUtil.setup(this,function(param1:String):*
  305.          {
  306.             return target[param1];
  307.          },bindings,watchers);
  308.          i = 0;
  309.          while(i < bindings.length)
  310.          {
  311.             Binding(bindings[i]).execute();
  312.             i++;
  313.          }
  314.          mx_internal::_bindings = mx_internal::_bindings.concat(bindings);
  315.          mx_internal::_watchers = mx_internal::_watchers.concat(watchers);
  316.          super.initialize();
  317.       }
  318.       
  319.       [Bindable(event="propertyChange")]
  320.       public function get _save() : Button
  321.       {
  322.          return this._91257436_save;
  323.       }
  324.       
  325.       [Bindable(event="propertyChange")]
  326.       public function get _deselectAll() : Button
  327.       {
  328.          return this._17584667_deselectAll;
  329.       }
  330.       
  331.       protected function onClick(param1:MouseEvent) : void
  332.       {
  333.          var _loc2_:Object = null;
  334.          switch(param1.target)
  335.          {
  336.             case _selectAll:
  337.                for each(_loc2_ in dataProvider)
  338.                {
  339.                   _loc2_.selected = true;
  340.                }
  341.                _list.dataProvider = dataProvider;
  342.                break;
  343.             case _deselectAll:
  344.                for each(_loc2_ in dataProvider)
  345.                {
  346.                   _loc2_.selected = false;
  347.                }
  348.                _list.dataProvider = dataProvider;
  349.                break;
  350.             case _save:
  351.                dispatchEvent(new Event("ok"));
  352.                super.onCancel();
  353.                break;
  354.             case _quit:
  355.                for each(_loc2_ in dataProvider)
  356.                {
  357.                   _loc2_.selected = false;
  358.                }
  359.                _list.dataProvider = dataProvider;
  360.                dispatchEvent(new Event("ok"));
  361.                super.onCancel();
  362.          }
  363.       }
  364.       
  365.       private function _SaveMultipleDialog_bindingsSetup() : Array
  366.       {
  367.          var binding:Binding = null;
  368.          var result:Array = [];
  369.          binding = new Binding(this,function():Object
  370.          {
  371.             return dataProvider;
  372.          },function(param1:Object):void
  373.          {
  374.             _list.dataProvider = param1;
  375.          },"_list.dataProvider");
  376.          result[0] = binding;
  377.          return result;
  378.       }
  379.       
  380.       [Bindable(event="propertyChange")]
  381.       public function get _quit() : Button
  382.       {
  383.          return this._91216686_quit;
  384.       }
  385.       
  386.       public function ___selectAll_click(param1:MouseEvent) : void
  387.       {
  388.          onClick(param1);
  389.       }
  390.       
  391.       [Bindable(event="propertyChange")]
  392.       public function get _cancel() : Button
  393.       {
  394.          return this._1340746649_cancel;
  395.       }
  396.       
  397.       public function set _cancel(param1:Button) : void
  398.       {
  399.          var _loc2_:Object = this._1340746649_cancel;
  400.          if(_loc2_ !== param1)
  401.          {
  402.             this._1340746649_cancel = param1;
  403.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_cancel",_loc2_,param1));
  404.          }
  405.       }
  406.       
  407.       private function _SaveMultipleDialog_bindingExprs() : void
  408.       {
  409.          var _loc1_:* = undefined;
  410.          _loc1_ = dataProvider;
  411.       }
  412.       
  413.       [Bindable(event="propertyChange")]
  414.       public function get _list() : List
  415.       {
  416.          return this._91056509_list;
  417.       }
  418.       
  419.       public function set _save(param1:Button) : void
  420.       {
  421.          var _loc2_:Object = this._91257436_save;
  422.          if(_loc2_ !== param1)
  423.          {
  424.             this._91257436_save = param1;
  425.             this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_save",_loc2_,param1));
  426.          }
  427.       }
  428.    }
  429. }
  430.  
  431.